import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
const TOKEN_KEY='TOUTIAO_USER'
export default new Vuex.Store({
  state: {
    usertoken:JSON.parse(window.localStorage.getItem(TOKEN_KEY))
  },
  mutations: {
    // 保存user信息
    setToken(state,usertoken){
      state.usertoken=usertoken
       // // 本地存储token
        window.localStorage.setItem(TOKEN_KEY,JSON.stringify(state.usertoken));
    },
    deleuser(state){
      state.usertoken=null
    }
  },
  actions: {
  },
  modules: {
  }
})
